package com.miage.kangourou.server.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import com.miage.kangourou.shared.Const;

/**
 * Méthode Base de Données
 */
public class ConnectionManager {
	private static final String DATABASE = Const.DATABASE_URL;
	private static final String USER = Const.DATABASE_USERNAME;
	private static final String PASSWORD = Const.DATABASE_PASSWORD;
	private static Connection connexion;

	public static Connection getInstance() {
		if (connexion == null) {
			try {
				connexion = DriverManager.getConnection(DATABASE, USER,
						PASSWORD);
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return connexion;
	}
}
